<?php
require_once('mysql_table.php');

class compra_prov extends mysql_table{

    function __construct(){
        parent::__construct();
        $this->TableName = "COMPRAS_PROV";
        $this->IDField = "ID";        
        
        $this->fields['ID']  = "";
        $this->fields['ID_PROVEEDOR']  = "";
        $this->fields['ID_CALIFICACION']  = "";
        $this->fields['FECHA_PEDIDO']  = "";
        $this->fields['FECHA_ENTREGA']  = "";
        $this->fields['CANTIDAD_TOTAL']  = "";
        $this->fields['COSTO_TOTAL']  = "";
        $this->fields['ID_STATUS']  = "";
        
    }
    
    /**
     *@return todos lo que no esten inactivos
     *@example para listarlos
     **/
    function buscar(){
        
        $query = "SELECT COMPRAS_PROV.*, PROVEEDORES.NOMBRE AS NOMBRE, 
        PROVEEDORES.APELLIDO AS APELLIDO, STATUS.DESCRIPCION AS STATUS 
        FROM COMPRAS_PROV, PROVEEDORES, STATUS WHERE COMPRAS_PROV.ID_STATUS != 0 AND 
        COMPRAS_PROV.ID_PROVEEDOR = PROVEEDORES.ID AND COMPRAS_PROV.ID_STATUS = STATUS.ID";
        $salida = $this->tovector_assoc_query($query);
        //print($query);
        return $salida;
            
    }
}
?>
